<?php


namespace app\impl;


use catcher\exceptions\FailedException;
use think\exception\HttpException;

class SimpleFactory
{

    /**
     * 投递任务
     * @param string $tubeName
     * @return mixed
     */
    public static function getTask(string $tubeName)
    {
        $tubeName = "app\\impl\\" . $tubeName;
        if (class_exists($tubeName)) {
            return new $tubeName();
        }
        throw new FailedException("实现类{$tubeName}不存在");
    }
}